#是否开启调试宏
#OM_UDP,COM_RS485,COM_HPLC,COM_MESH用于定义不同的通信模式，根据需要进行编译，需要包含相应实现文件夹
add_definitions(-DSOFTBUS_DEBUG -DCOM_UDP)

#条件编译宏
option(UDP_ON "Enable UDP Transport" ON)
option(RS485_ON "Enable UDP Transport" OFF)
option(HPLC_ON "Enable UDP Transport" OFF)
option(MESH_ON "Enable UDP Transport" OFF)

#开启系统宏
if(${UDP_ON} STREQUAL "ON")
add_definitions(-DCOM_UDP)
endif()

if(${UDP_ON} STREQUAL "ON")
add_definitions(-DCOM_RS485)
endif()

if(${UDP_ON} STREQUAL "ON")
add_definitions(-DCOM_HPLC)
endif()

if(${UDP_ON} STREQUAL "ON")
add_definitions(-DCOM_MESH)
endif()


add_definitions(-D__LINUX__ -D_GNU_SOURCE -D_SCANTY_MEMORY_)

#目前编译linux版本，需要加上rt，支持消息队列
set(CMAKE_C_FLAGS "-Wall -fPIC -Wno-deprecated -lrt")    #设置编译选项


#设置工程根目录
set(ROOT_DIR ${PROJECT_SOURCE_DIR})



#添加包含的头文件路径
include_directories(
        "interfaces/" 
        "discovery/discovery_service/include/"
        "trans_service/include/"

        #UDP方式下编译依赖 begin
        "communication/udp/include/"

        #UDP方式下编译依赖 end        

        #外部依赖		
        "${ROOT_DIR}/src/utils/log/" 
        "${ROOT_DIR}/src/os_adapter/"
        "${ROOT_DIR}/src/third_party/bounds_checking_function/include/"
)


#设置源代码文件列表
set(SOURCE_LIST 
    "discovery/discovery_service/source/discovery_service.c"
    "discovery/discovery_service/source/bus_manager.c"
    "trans_service/source/session_manager.c"

  

    #UDP方式下编译依赖 begin
    "communication/udp/source/udp_discovery_service.c"
    "communication/udp/source/udp_socket.c"


    #UDP方式下编译依赖 end


    #系统依赖
    "${ROOT_DIR}/src/os_adapter/linux/os_adapter.c"  #linux下包含
    #"${ROOT_DIR}/src/os_adapter/rtthread/os_adapter.c"  #rtthread下包含，不通过CMAKE编译
)


#生成动态库
add_library(jy-softbus SHARED ${SOURCE_LIST})

target_link_libraries(jy-softbus bounds_checking_function_lite)   

#设置动态库的版本
SET_TARGET_PROPERTIES(jy-softbus  PROPERTIES VERSION 1.0 SOVERSION 1)


set(LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/../out")




